package com.nineshadow.games.redismq;

import com.nineshadow.games.constants.CommonConstants;
import com.nineshadow.games.launch.HallServer;
import com.nineshadow.games.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author 描述：发布service
 */
@Component
public class PublishService {
	@Autowired
	private RedisUtil redisUtil;

	/**
	 * @author 描述：发布方法
	 * @param roomId 房间id
	 * @param message 消息信息
	 */
	public void publish(String roomId,Integer targetId, Object message) {
		Map<String,Object> map= (Map<String, Object>) message;
		map.put("roomId",roomId);
		redisUtil.lSet(CommonConstants.USER_POLL_QUEUE+roomId+":"+targetId,map,CommonConstants.EXPIRE_TIME);
	}
}
